package com.example.demo.sys.mapper;

import com.example.demo.sys.entity.Studentwork;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 *  Mapper 接口 chrimer
 * </p>
 *
 * @author chrimer
 * @since 2020-07-01
 */
public interface StudentworkMapper extends BaseMapper<Studentwork> {

    @Select("Select parentName from  coursevideo WHERE id=#{id}")
    String SelectParentName(String id);

    @Select("Select score from  studentwork WHERE userId=#{userId} and courseId = #{courseId}")
    List<Integer> SelectScore(String userId,String courseId);

    @Select("Select parentName from  studentwork WHERE userId=#{userId} and courseId = #{courseId}")
    List<String> SelectparentName(String userId,String courseId);

    @Update("UPDATE coursemanager SET grade=#{scoreSum} WHERE userId=#{userId} and courseId = #{courseId}")
    void UpdateGrade(int scoreSum, String userId,String courseId);
}
